// JavaScript Document
stateprofile = jQuery.noConflict();
stateprofile().ready(function() {
	stateprofile("#profile-state-node-form").validate({
									  


	//Title Validation
	rules: {
		'title':{
			required:true,
			badchar:true,
			minlength: 5,
			maxlength: 255,
		},
		'field_tn_population[und][0][value]':{
			required:true,
			badchar:true,
			maxlength: 255,
		},
		'field_tn_capital[und][0][value]':{
			required:true,
			badchar:true,
			maxlength: 255,
		},
		'field_tn_languages[und][0][value]':{
			required:true,
			badchar:true,
			maxlength: 255,
		},
	},
	messages: {
		'title':{
			required:'Please enter the Area',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed' ,
			minlength: 'Minimum 5 characters should be entered',
			maxlength: 'Minimum 255 characters should be entered',
		},
		'field_tn_population[und][0][value]':{
			required:'Please enter the Population',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed' ,
			maxlength: 'Minimum 255 characters should be entered',
		},
		'field_tn_capital[und][0][value]':{
			required:'Please enter the Capital',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed' ,
			maxlength: 'Minimum 255 characters should be entered',
		},
		'field_tn_languages[und][0][value]':{
			required:'Please enter the Languages',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed' ,
			maxlength: 'Minimum 255 characters should be entered',
		},
	},
	errorLabelContainer: "#errormsg_container",
	invalidHandler: function(form, validator) {
	
				 if (!validator.numberOfInvalids())
					return;
			else{
				
				  //stateprofile("#documents-node-form").create_errormsg_container('errormsg_container','documents-node-form');
			}
				
				 stateprofile('html, body').animate({
					scrollTop: stateprofile(validator.errorList[0].element).offset().top - 100
				}, 1000);
				
			},
	
	
	
	});

});	